<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let num = 100
        // 本金

        while (true) {

            // 提示框
            let a = +prompt(`
            请输入对应的数字：
            1.存钱
            2.取钱
            3.查看余额
            4.退出`)
            // 退出循环应与while同一级
            if (a === 4) {
                break
            }
            switch (a) {
                // 存钱
                case 1:
                    let money = +prompt('请输入存钱金额')
                    num = num + money


                    break
                // 取钱
                case 2:
                    let money1 = +prompt('请输入取钱金额')
                    num = num - money1
                    break
                // 查询
                case 3:
                    alert(`余额为${num}`)
                    break

            }


        }

    </script>
</body>

</html>